<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>随机10*10</title>
		<style>
		table{
			border:#00ffff solid 2px;
			border-collapse:collapse;
		}
		td{
			border:#8080ff solid 2px;
			padding:10px;
		}
	</style>
	</head>
	<body>
		<input type="text" id="txt1">
		<input type="text" id="txt2">
		<button id="btn">创建</button>
		<br/><br/>
		<input type="text" id="txt3">行
		<button id="btn1">删除</button>
		<div id="div1"></div>
	</body>
</html>
<script src="pool.js" ></script>
<script>
	//动态创建表格  10  10  随机数   背景颜色   禁止用字符串拼接    createElement  appendChidl()
	btn.onclick=function () {
		document.getElementById("div1").innerHTML="";
		var oTable = document.createElement('table');
		var m = document.getElementById("txt1").value;
		var n =  document.getElementById("txt2").value;
		for(var i=0;i<m;i++){
	            var oTr=document.createElement("tr");
	            oTable.appendChild(oTr);
	            for(var j=0;j<n;j++){
	                var oTd=document.createElement("td");
	                oTr.appendChild(oTd);
	                oTd.innerHTML=parseInt(10+Math.random()*90);
	                oTd.style.background=randomColor();
	            }
	        }
	        document.getElementById("div1").appendChild(oTable);
	        btn1.onclick=function () {
	            var m1 = document.getElementById("txt3").value-1;
	            oTable.deleteRow(m1);
        }
	};
</script>